One of my blog readers kindly asked if I can provide a similar script like the one downloading all Intune PowerShell scripts for the Proactive Remediation Scripts. I’m happy to provide a modified version of my script to do exactly this. It uses the same technique as I used in my old script. There are always a lot of ways to accomplish your goals, for example using the Microsoft.Graph.DeviceManagement Module. But anyway, I decided to recycle my old script to download the HealthScripts wich are the Proactive Remediation scripts.
The function uses the Intune PowerShell SDK like the “PowerShell Script Download” script:
It is super easy to use, just call it with the FolderPath parameter to download all Proactive Remediation Scripts:
Get-DeviceHealthScripts -FolderPath C:\temp\HealthScripts
Your specified folder will give you access to all your scripts organized by folders (folder names derived from Proactive Remediation display name):
The folders contain the Detection script and if available also the Remediation script.
The complete script can be found here:
https://github.com/okieselbach/Intune/blob/master/Get-DeviceHealthScripts.ps1
I hope again it helps some people with lost original scripts or consultants without access to the original files. It can also be handy during tenant-to-tenant migrations.
Happy downloading!
Hello Oliver,
Getting following when I tried executing the script.Required module is already imported and connected.
Get-DeviceHealthScripts : The term ‘Get-DeviceHealthScripts’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-DeviceHealthScripts -FolderPath C:\temp\HealthScripts
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-DeviceHealthScripts:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Hey Raj,
did you download the whole script and tried to run it like PS c:> C:\temp\GetDeviceHealthScripts.ps1
keep an eye here on the extension .ps1 to run the script, otherwise PS tries to find a cmdlet.
best,
Oliver
This is certainly a good tip – getting scripts back from other areas have been certainly problematic before!
Apologies if this has been asked before – is there much overhead in running remediation scripts? Is there a thing as too many?
Remediation scripts are limited to max 200 per tenant. And yes there is an overhead. If you schedule 200 scripts to run every 1h this means a lot of PowerShell.exe processes in the end. So don‘t get crazy and remove unnecessary scripts at a later time.